package com.test.springboot3.springboot3testdemo1.servlet;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletRegistration;
import org.springframework.boot.web.servlet.ServletContextInitializer;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/8/2-下午12:50
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
// @Component
public class ServletComponent implements ServletContextInitializer {

  /**
   * @param servletContext the {@code ServletContext} to initialize
   */
  @Override
  public void onStartup(ServletContext servletContext) {
    ServletRegistration initServlet = servletContext.addServlet("initServlet", new InitServlet());
    initServlet.addMapping("/initServlet");
    initServlet.setInitParameter("name", "initServlet");
    initServlet.setInitParameter("sex", "male");
  }
}
